<template>
  <el-form ref="menuForm" :model="menuForm" label-width="100px">
    <el-form-item label="上级菜单">
      <el-input v-model="parentName" disabled />
    </el-form-item>
    <el-form-item :label="isButton ? '按钮名称' : '菜单名称'" prop="name" :rules="rules.required">
      <el-input v-model="menuForm.name" placeholder="请输入菜单名称" />
    </el-form-item>
    <el-form-item :label="isButton ? '按钮编码' : '菜单编码'" prop="code" :rules="[rules.required, rules.code]">
      <el-input v-model="menuForm.code" placeholder="请输入菜单编码" />
    </el-form-item>
    <el-form-item v-if="isButton" label="资源编码" prop="resource" :rules="[rules.required]">
      <el-input v-model="menuForm.resource" placeholder="请输入权限编码" />
    </el-form-item>
    <el-form-item v-else label="路由地址" prop="url" :rules="[rules.required]">
      <el-input v-model="menuForm.url" placeholder="请输入路由地址" />
    </el-form-item>
    <el-form-item v-if="!isButton" label="图标类名" prop="icon">
      <el-input v-model="menuForm.icon" placeholder="请输入菜单图标" />
    </el-form-item>
    <el-form-item v-if="!isButton" label="菜单描述" prop="description">
      <el-input v-model="menuForm.description" placeholder="请输入菜单描述" />
    </el-form-item>
  </el-form>
</template>
<script>
import rules from '../../../utils/rules.js'

export default {
  components: {},
  props: ['menuForm', 'parentName', 'isButton'],
  data() {
    return {
      rules
    }
  },
  created() {},
  methods: {}
}
</script>
<style lang="scss" scoped></style>
